﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head><link rel="stylesheet" href="${ctx}/common/common.css">
    <title>Title</title>
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="${ctx}/common/plugins/layuiadmin/style/admin.css" media="all">
    <script src="${ctx}/common/plugins/layuiadmin/layui/layui.js"></script>
    
</head>
<body>
<form class="layui-form"  action="${ctx}/person/savePerson1"  >
    <input type="hidden" name="id" value="${person.id}" />
    <input type="hidden" name="tEId" value="${person.tEId}" />
    <input type="hidden" name="creatorId" value="${person.creatorId}" />
    <input type="hidden" name="creatorName" value="${person.creatorName}" />
    <div class="layui-form-item layui-col-md5" style="margin-top: 50px">
        <label class="layui-form-label">人员姓名</label>
        <div class="layui-input-block">
            <input type="text" name="name"  lay-verify="required" value="${person.name}"   lay-verify="required" placeholder="请输入人员名称" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">联系电话</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="required|phone|number" ${!empty detail?"disabled":"" } value="${person.phone}" placeholder="请输入联系电话" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">电子邮箱</label>
        <div class="layui-input-block">
            <input type="text" name="email"   lay-verify="required|email"  value="${person.email}"  placeholder="请输入电子邮箱" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">身份证</label>
        <div class="layui-input-block">
            <input type="text" name="idcard"   lay-verify="required|identity"  value="${person.idcard}"  placeholder="请输入身份证" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">入职时间</label>
        <div class="layui-input-block">
            <input type="text" name="entryTime" id="entry_time" ${!empty detail?"disabled":"" }  lay-verify="" value="<fmt:formatDate value='${person.entryTime}' pattern="yyyy-MM-dd"/>"  placeholder="请选择入职时间" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">文化程度</label>
        <div class="layui-input-block">
            <select name="cultureDegree"  ${!empty detail?"disabled":"" }>
                <option value="">请选择文化程度</option>
                <c:forEach items="${education}" var="e">
                    <option value="${e.id }" ${person.cultureDegree eq e.id ? "selected":""}>${e.described}</option>
                </c:forEach>
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">职称</label>
        <div class="layui-input-block">
            <select   name="jobTitle"  ${!empty detail?"disabled":"" }>
                <option value="">请选择职称</option>
                <c:forEach items="${titles}" var="e">
                    <option value="${e.id }" ${person.jobTitle eq e.id ? "selected":""}>${e.described}</option>
                </c:forEach>
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">专业</label>
        <div class="layui-input-block">
            <select  name="major"  ${!empty detail?"disabled":"" }>
                <option value="">请选择专业</option>
                <c:forEach items="${major}" var="e">
                    <option value="${e.id }" ${person.major eq e.id ? "selected":""}>${e.described}</option>
                </c:forEach>
            </select>
        </div>
    </div>
    <div class="layui-form-item  layui-col-md5">
        <label class="layui-form-label">是否离职</label>
        <div class="layui-input-block">
            <input type="radio" lay-filter="is_over" ${!empty detail?"disabled":"" }  name="isOver" ${person.isOver eq 'on'?'checked':''} value="on" title="离职">
            <input type="radio" lay-filter="is_over" ${!empty detail?"disabled":"" }  checked name="isOver" ${person.isOver eq 'off'?'checked':''} value="off" title="在职">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5" style="${person.isOver eq 'on'?'':'display: none'}"   id="overDiv">
        <label class="layui-form-label">离职时间</label>
        <div class="layui-input-block">
            <input type="text" name="overTime" ${!empty detail?"disabled":"" }  id="over_time" lay-verify="" value="<fmt:formatDate value='${person.overTime}' pattern="yyyy-MM-dd"/>"  placeholder="请输入离职时间" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-col-md5">
        <label class="layui-form-label">职务</label>
        <div class="layui-input-block">
            <select  name="job"  ${!empty detail?"disabled":"" }>
                <option value="">请选择职务</option>
                <c:forEach items="${job}" var="e">
                    <option value="${e.id }" ${person.job eq e.id ? "selected":""}>${e.described}</option>
                </c:forEach>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">人员性别</label>
        <div class="layui-input-block">
            <input type="radio" ${!empty detail?"disabled":"" } name="sex" ${person.sex eq '男'?'checked':''} value="男" title="男">
            <input type="radio" ${!empty detail?"disabled":"" } name="sex" ${person.sex eq '女'?'checked':''} value="女" title="女">
        </div>
    </div>
    <div class="layui-form-item  layui-col-md5">
        <label class="layui-form-label">所属部门</label>
        <div class="layui-input-block">
            <input type="text" name="dept" lay-type="showTree" ${!empty detail?"disabled":"" }     class="layui-input dept" id="dept" value="${department.name}" readonly placeholder="请选择部门" >
            <input type="hidden" name="tDId" id="deptId"   value="${person.tDId}"  >
        </div>
    </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" id="formBtn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
   
</form>
<script>

    //Demo
    layui.use('form', function(){
        var  form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
           layer.load(1, {
                shade: [0.1,'#fff'] //0.1透明度的白色背景
            });
        });
        form.verify({
            identity : function(value) {
                if (value.length != 18) {
                    return '请输入正确的身份证号';
                }
            },
            number : [/^[0-9]*$/, '必须输入数字啊']
        });
        var $=layui.$;
        $("#dept").on("click",function(){
            layer.open({
                type: 2,
                title: '部门信息',
                shadeClose: true,
                offset: '10px',
                shade: 0.8,
                area: ['30%', '80%'],
                content: '${ctx}/person/queryMyDeptPage' //iframe的url
            });

        })
        form.on('radio(is_over)', function(data){
            if(data.value=="on"){
                $("#overDiv").show();
            }else{
                $("#overDiv").hide();
            }
        });
    });

    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#entry_time' //指定元素
            ,type: 'date'
        });
        laydate.render({
            elem: '#over_time' //指定元素
            ,type: 'date'
        });
    });



</script>
</body>
</html>



